package com.dianhun.cn.controller;

import com.dianhun.cn.pojo.Person;
import com.dianhun.cn.pojo.Teacher;
import com.dianhun.cn.send.Sender;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author cyt
 * @create 2020-08-24 13:56
 */
@RestController
public class SendController {
    @Resource
    private Sender sender;

    @GetMapping("mq")
    public String mq() {
        sender.send();
        return "消息已发送..";
    }




    @GetMapping("send")
    public String send(@Validated(Person.PersonInsertGroup.class) Person person) {
        sender.send();
        return "消息已发送..";
    }

    @GetMapping("test")
    public String test(@Valid Teacher teacher) {
        return "消息已发送..";
    }
}
